# Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base


private

  def general_authorize
    @logged_in_user = User.find_by_id(session[:user_id])
    if @logged_in_user.nil?
      if request.xhr?
        redirect_to(:controller => 'auth', :action => 'xhr_auth_failure')
      else
        if request.get?
          flash[:original_uri]=request.request_uri
        end
        flash[:notice] = "Please log in"
        redirect_to(:controller => "auth", :action => "login")
      end
    else
      session[:original_uri] = nil
    end
  end
	
  def time_from_params
    Time.mktime(Time.now.year,params[:date][:month],params[:date][:day],params[:date][:hour],params[:date][:minute])
  end
end